package com.ljs.threadpooldemo.service;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Service
public class TestAsynServiceImpl implements TestAsynService{
    //开启异步操作，不能再同一个类调用
    @Async("taskExecutor")
    @Override
    public void testAsyn() {
        System.out.println("异步操作当前线程开始启动"+Thread.currentThread().getName());
        for(int i=0;i<100000;i++){
            System.out.println("异步操作"+i);

        }
        System.out.println("异步操作当前线程结束操作"+Thread.currentThread().getName());
    }
}
